-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pci: add pci device support in dbs-cli #30
Conversation
Signed-off-by: Chao Wu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @studychao, a few comments here.
README.md
Outdated
|
||
You can choose to attach a pci device during the boot time of Dragonball. | ||
``` | ||
./dbs-cli create --log-file $LOG_FILE --log-level $LOG_LEVEL --kernel-path $KERNEL_PATH --rootfs $ROOTFS_PATH --boot-args "console=ttyS0 tty0 reboot=k debug panic=1 root=/dev/vda1" --hostdev-id $HOST_DEVICE_ID --sysfs-path $SYSFS_PATH --bus-slot-func $BUS_SLOT_FUNC --vendor-device-id $VENDOR_DEVICE_ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give an example of how to acquire those values? For example:
Get Xxxxxx's hostdev-id
by lspci
$ lspci
02:00.0 Xxxxxx
$ HOST_DEVICE_ID="02:00.0"
I think leaving the part of adding PCI device is enough. Otherwise, it looks too complicated to read.
--hostdev-id $HOST_DEVICE_ID \
--sysfs-path $SYSFS_PATH \
--bus-slot-func $BUS_SLOT_FUNC \
--vendor-device-id $VENDOR_DEVICE_ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/cli_instance.rs
Outdated
@@ -153,6 +157,31 @@ impl CliInstance { | |||
.expect("failed to set vsock socket path"); | |||
} | |||
|
|||
if !args.host_device.hostdev_id.is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !args.host_device.hostdev_id.is_none() { | |
if let Some(hostdev_id) = args.host_device.hostdev_id { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually this is for checking whether user provide hostdev_id and bus_slot_func in the command line (which are the must parameters) and I was being lazy to just check one of the parameters......
I have completed this part and also added a comment above.
src/cli_instance.rs
Outdated
hostdev_id: args | ||
.host_device | ||
.hostdev_id | ||
.expect("There has to be hostdev_id if you want to add host device."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hostdev_id: args | |
.host_device | |
.hostdev_id | |
.expect("There has to be hostdev_id if you want to add host device."), | |
hostdev_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
7413e45
to
12b8357
Compare
1. attach pci device during the boot time of Dragonball. 2. hot plug pci device when the Dragonball is running. 3. prepare to hot unplug pci device when the Dragonball is running. 4. hot unplug pci device when the Dragonball is running. fixes: openanolis#29 Signed-off-by: Chao Wu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, thanks @studychao!
fixes: #29